home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 22 / macformat_22.iso / Shareware / Programación / The Gray Council 1.1 / source / PowerPlant / GrayCouncilPP.h < prev   
Encoding:
Text File  |  1996-08-08  |  30.4 KB  |  1,055 lines  |  [TEXT/CWIE]

  1. //
  2. // GrayCouncilPP
  3. // Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
  4. //
  5. // PowerPlant adapter classes for core Gray Council.
  6. //
  7. // Before using any of the GrayCouncil source code, read and
  8. // follow the licensing info in the accompanying documentation
  9. // or contact:
  10. //   <trygve@kagi.com>
  11. //   <http://www.kagi.com/authors/trygve/>
  12. //
  13. // GrayCouncil provides a set of standard C++ classes that implement
  14. // the standard Apple Grayscale Appearance. The core classes do not
  15. // require any other code such as a particular class framework.
  16. //
  17. // This file defines a set of helper classes that derive from standard
  18. // PowerPlant pane classes, and interface with the core Gray Council code.
  19. // There are also a couple of attachment subclasses for attaching to
  20. // other pane classes to get a white background and 3D frame.
  21. //
  22. // Normally, to use a GrayCouncil PowerPlant class, you can simply change the
  23. // class ID of the pane in your Constructor window resource to the
  24. // class ID of the appropriate Gray Council PowerPlant adapter class. For
  25. // example, to use the GC pushbutton, create a normal LButton pane,
  26. // and set its class ID to 'GCpb'. Voila. This also works for the LAttachment
  27. // subclasses defined here.
  28. //
  29. // A couple of the classes use the mUserCon field of the subview to specify
  30. // additional information such as icon IDs, string resource IDs, etc.
  31. //
  32. // If the mUserCon usage conflicts with what you are already doing with it,
  33. // you can use the "extended" pane subclasses (those whose class name ends
  34. // in "PPX" instead of "PP"). These classes read their additional info from
  35. // the pane resource stream instead of using mUserCon. In some cases they
  36. // let you specify additional options in the pane resource that you would
  37. // otherwise have to specify programmatically. The supplied resource file
  38. // named GCCustomPanes.rsrc contains the 'CPPb' custom pane types.
  39. // If you put this file in the Constructor app's folder, or keep it open
  40. // whenever your pane resource file is open, or paste the custom pane
  41. // types into your pane resource file, you can use the extended pane classes
  42. // in Constructor.
  43. //
  44. // Each class here that interfaces to a core AGAObject has a public
  45. // member variable called mAGAObject that points to the actual AGAObject
  46. // subclass object. Certain extended object settings (such as mixed-state
  47. // buttons, proportional and live scrolling, etc.) require you to call
  48. // the AGAObject to set it. The member variable is made public to keep
  49. // these PowerPlant classes as lightweight as possible; you make the call,
  50. // rather than using myriad new functions of the PowerPlant AGA subclasses.
  51. //
  52. // Classes defined below:
  53. //    AGAWindowPP -- LWindow subclass that draws a modeless window gray
  54. //        background.
  55. //    AGADialogBoxPP -- LDialogBox subclass that draws a modal window gray
  56. //        background and replaces the PowerPlant default button outline by
  57. //        altering the style of the default button AGAPushButton object.
  58. //    AGAPushButtonPP -- LStdButton subclass for AGAPushButton.
  59. //    AGACheckBoxPP -- LStdCheckBox subclass for AGACheckBox.
  60. //    AGARadioButtonPP -- LStdRadioButton subclass for AGARadioButton.
  61. //    AGAIconPushButtonPP -- AGAPushButtonPP (LStdButton) subclass for
  62. //        AGAIconPushButton.
  63. //    AGAIconPushButtonPPX -- AGAIconPushButtonPP (LStdButton) subclass for
  64. //        AGAIconPushButton, that uses extended CPPb data for the icon ID.
  65. //    AGAIconCheckBoxPP -- AGACheckBoxPP (LStdCheckBox) subclass for
  66. //        AGAIconCheckBox.
  67. //    AGAIconCheckBoxPPX -- AGAIconCheckBoxPP (LStdCheckBox) subclass for
  68. //        AGAIconCheckBox, that uses extended CPPb data for the icon IDs.
  69. //    AGAIconRadioButtonPP -- AGARadioButtonPP (LStdRadioButton) subclass
  70. //        for AGAIconRadioButton.
  71. //    AGAIconRadioButtonPPX -- AGAIconRadioButtonPP (LStdRadioButton) subclass
  72. //        for AGAIconRadioButton, that uses extended CPPb data for the icon IDs.
  73. //    AGAIconRadioButtonMA -- AGARadioButtonMA (LStdRadioButton) subclass for
  74. //        AGAIconRadioButton.
  75. //    AGAGroupBoxPP -- LGroupBox subclass for AGAGroupBox, with primary group
  76. //        box appearance.
  77. //    AGAGroupBoxPPX -- AGAGroupBoxPP (LGroupBox) subclass for AGAGroupBox,
  78. //        that uses extended CPPb data for the box type and gap pane ID.
  79. //    AGASecondaryGroupBoxPP -- AGAGroupBoxPP (LGroupBox) subclass for
  80. //        AGAGroupBox, with secondary group box appearance.
  81. //    AGAScrollBarPP -- LStdControl subclass for AGAScrollBar.
  82. //    AGAScrollerPP -- LScroller subclass that replaces the normal LStdControl
  83. //        scroll bars with ones of class AGAScrollBarPP, and correctly
  84. //        maintain them during scrolling.
  85. //    AGASliderPP -- LControl subclass for AGASlider.
  86. //    AGASliderPPX -- AGASliderPP (LControl) subclass for AGASlider, that
  87. //        uses extended CPPb data for the label strings ID, style, and
  88. //        slider justification.
  89. //    AGALittleArrowsPP -- LControl subclass for AGALittleArrows.
  90. //    AGALittleArrowsPPX -- AGALittleArrowsPP (LControl) subclass for
  91. //        AGALittleArrows, that uses extended CPPb data for the linked
  92. //        numeric LEditField pane ID.
  93. //    AGAPopupMenuPP -- LStdPopupMenu subclass for AGAPopupMenu.
  94. //    AGADisclosureTrianglePP -- LControl subclass for AGADisclosureTriangle.
  95. //    AGAProgressIndicatorPP -- LControl subclass for AGAProgressIndicator.
  96. //    AGAWhiteBackgroundAttachmentPP -- LAttachment subclass that draws a
  97. //        white background for the pane to which it is attached.
  98. //    AGABorderFrameAttachmentPP -- LAttachment subclass that draws a
  99. //        "3D" sunken frame around the pane to which it is attached.
  100. //    AGAEditFieldPP -- LEditField subclass that automatically attaches an
  101. //        AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP,
  102. //        and also knows how to draw the frame in disabled gray when disabled.
  103. //    AGATextEditPP -- LTextEdit subclass that automatically attaches an
  104. //        AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP.
  105. //    AGASeparatorPP -- LPane subclass for AGASeparator.
  106. //    AGACaptionPP -- LCaption subclass for AGAStaticText.
  107. //    AGAFocusBoxPP -- LFocusBox subclass used by AGAListBox to draw the
  108. //        list box focus frame.
  109. //    AGAListBoxPP -- LListBox subclass that automatically attaches an
  110. //        AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP,
  111. //        and also replaces the normal LFocusBox with an AGAFocusBoxPP so
  112. //        that the focus frame appears correct.
  113. //
  114.  
  115. #ifndef __GRAYCOUNCILPP__
  116. #define __GRAYCOUNCILMA__
  117.  
  118. #include "GrayCouncil.h"
  119.  
  120. #include "LGroupBox.h"
  121.  
  122. //
  123. // You must call InitGrayCouncilPP after initializing PowerPlant and the
  124. // Toolbox and before instantiating any GrayCouncil objects. This routine
  125. // registers the PowerPlant classes and then calls the core InitGrayCouncil
  126. // function for you. If it returns an error, you should quit. The only
  127. // current error situation of this is an out-of-memory condition
  128. // during initialization.
  129. //
  130.  
  131. extern OSErr InitGrayCouncilPP();
  132.  
  133. //
  134. // AGAWindowPP ----------------------------------------------------
  135. //
  136. // LWindow replacement subclass.
  137. // Makes sure the background is modeless shaded gray.
  138. // Knows how to shade around the grow box.
  139. //
  140.  
  141. class AGAWindowPP : public LWindow
  142.     {
  143.     public:
  144.  
  145.         AGAWindowPP(LStream* inStream);
  146.         virtual ~AGAWindowPP();
  147.         
  148.         enum { class_ID = 'GCwn' };
  149.         static AGAWindowPP*    CreateStream(LStream* inStream);
  150.  
  151.         // PowerPlant overrides
  152.         virtual void    FinishCreate();
  153.         virtual void    DrawSelf();
  154.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  155.  
  156.     protected:
  157.  
  158.         // PowerPlant overrides
  159.         virtual void    FinishCreateSelf();
  160.         virtual void    ActivateSelf();
  161.         virtual void    DeactivateSelf();
  162.         
  163.         virtual void    DrawBackground(const Rect* area, Boolean fill, Boolean active);
  164.         virtual void    InvalidateEdges(Boolean before, Int16 inWidthDelta, Int16 inHeightDelta);
  165.     };
  166.  
  167. //
  168. // AGADialogBoxPP ----------------------------------------------------
  169. //
  170. // LDialogBox replacement subclass.
  171. // Makes sure the background is modal shaded gray and the default
  172. // button is drawn with an AGA-style default outline.
  173. // Knows how to shade around the grow box.
  174. //
  175.  
  176. class AGADialogBoxPP : public LDialogBox
  177.     {
  178.     public:
  179.  
  180.         AGADialogBoxPP(LStream* inStream);
  181.         virtual ~AGADialogBoxPP();
  182.         
  183.         enum { class_ID = 'GCdb' };
  184.         static AGADialogBoxPP*    CreateStream(LStream* inStream);
  185.  
  186.         // PowerPlant overrides
  187.         virtual void    FinishCreate();
  188.         virtual void    SetDefaultButton(PaneIDT inButtonID);
  189.         virtual void    DrawSelf();
  190.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  191.  
  192.     protected:
  193.  
  194.         // PowerPlant overrides
  195.         virtual void    FinishCreateSelf();
  196.         virtual void    ActivateSelf();
  197.         virtual void    DeactivateSelf();
  198.         
  199.         virtual void    DrawBackground(const Rect* area, Boolean fill, Boolean active);
  200.         virtual void    InvalidateEdges(Boolean before, Int16 inWidthDelta, Int16 inHeightDelta);
  201.  
  202.         Boolean    mDeleteDefaultOutline;
  203.     };
  204.  
  205. //
  206. // AGAPushButtonPP ----------------------------------------------------
  207. //
  208. // LStdButton replacement subclass.
  209. //
  210.  
  211. class AGAPushButtonPP : public LStdButton
  212.     {
  213.     public:
  214.  
  215.         AGAPushButtonPP(LStream* inStream);
  216.         virtual ~AGAPushButtonPP();
  217.         
  218.         AGAPushButton*    mAGAObject;
  219.  
  220.         enum { class_ID = 'GCpb' };
  221.         static AGAPushButtonPP*    CreateStream(LStream* inStream);
  222.  
  223.     protected:
  224.  
  225.         // PowerPlant overrides
  226.         virtual void    FinishCreateSelf();
  227.         virtual void    DrawSelf();
  228.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  229.         virtual void    HotSpotAction(SInt16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
  230.         virtual void    EnableSelf();
  231.         virtual void    DisableSelf();
  232.         virtual void    ShowSelf();
  233.  
  234.         virtual void    CreateAGAObject();
  235.     };
  236.  
  237. //
  238. // AGACheckBoxPP ----------------------------------------------------
  239. //
  240. // LStdCheckBox replacement subclass. To use mixed-state capability,
  241. // set/get the AGACheckBox state directly.
  242. //
  243.  
  244. class AGACheckBoxPP : public LStdCheckBox
  245.     {
  246.     public:
  247.  
  248.         AGACheckBoxPP(LStream* inStream);
  249.         virtual ~AGACheckBoxPP();
  250.         
  251.         AGACheckBox*    mAGAObject;
  252.  
  253.         enum { class_ID = 'GCcb' };
  254.         static AGACheckBoxPP*    CreateStream(LStream* inStream);
  255.  
  256.         // PowerPlant overrides
  257.         virtual void    SetValue(SInt32 inValue);
  258.  
  259.     protected:
  260.  
  261.         // PowerPlant overrides
  262.         virtual void    FinishCreateSelf();
  263.         virtual void    DrawSelf();
  264.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  265.         virtual void    HotSpotAction(SInt16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
  266.         virtual void    EnableSelf();
  267.         virtual void    DisableSelf();
  268.         virtual void    ShowSelf();
  269.  
  270.         virtual void    CreateAGAObject();
  271.     };
  272.  
  273. //
  274. // AGARadioButtonPP ----------------------------------------------------
  275. //
  276. // LStdRadioButton replacement subclass. To use mixed-state capability,
  277. // set/get the AGARadioButton state directly.
  278. //
  279.  
  280. class AGARadioButtonPP : public LStdRadioButton
  281.     {
  282.     public:
  283.  
  284.         AGARadioButtonPP(LStream* inStream);
  285.         virtual ~AGARadioButtonPP();
  286.         
  287.         AGARadioButton*    mAGAObject;
  288.  
  289.         enum { class_ID = 'GCrb' };
  290.         static AGARadioButtonPP*    CreateStream(LStream* inStream);
  291.  
  292.         // PowerPlant overrides
  293.         virtual void    SetValue(SInt32 inValue);
  294.  
  295.     protected:
  296.  
  297.         // PowerPlant overrides
  298.         virtual void    FinishCreateSelf();
  299.         virtual void    DrawSelf();
  300.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  301.         virtual void    HotSpotAction(SInt16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
  302.         virtual void    EnableSelf();
  303.         virtual void    DisableSelf();
  304.         virtual void    ShowSelf();
  305.  
  306.         virtual void    CreateAGAObject();
  307.     };
  308.  
  309. //
  310. // AGAIconPushButtonPP ----------------------------------------------------
  311. //
  312. // LStdButton replacement subclass that implements an icon button that behaves
  313. // like an LStdButton -- you click it does its HotSpotResult. The mUserCon is
  314. // used to obtain the button's icon ID. You can also set the icon ID of the
  315. // AGAIconPushButton directly (cast the mAGAObject to AGAIconPushButton*).
  316. //
  317.  
  318. class AGAIconPushButtonPP : public AGAPushButtonPP
  319.     {
  320.     public:
  321.  
  322.         AGAIconPushButtonPP(LStream* inStream);
  323.         virtual ~AGAIconPushButtonPP();
  324.         
  325.         enum { class_ID = 'GCip' };
  326.         static AGAIconPushButtonPP*    CreateStream(LStream* inStream);
  327.  
  328.     protected:
  329.  
  330.         virtual void    CreateAGAObject();
  331.         
  332.         // Extra AGA object initialization values
  333.         SInt16    mIconID;
  334.     };
  335.  
  336. //
  337. // AGAIconPushButtonPPX ----------------------------------------------------
  338. //
  339. // Extended AGAIconPushButtonPP class for use with custom pane template.
  340. // The icon ID is read from the stream.
  341. //
  342.  
  343. class AGAIconPushButtonPPX : public AGAIconPushButtonPP
  344.     {
  345.     public:
  346.  
  347.         AGAIconPushButtonPPX(LStream* inStream);
  348.         virtual ~AGAIconPushButtonPPX();
  349.         
  350.         enum { class_ID = 'GXip' };
  351.         static AGAIconPushButtonPPX*    CreateStream(LStream* inStream);
  352.     };
  353.  
  354. //
  355. // AGAIconCheckBoxPP ----------------------------------------------------
  356. //
  357. // LStdCheckBox replacement subclass that implements an icon button that behaves
  358. // like a check box -- you click it and it toggles its on/off state. The mUserCon
  359. // is used to obtain the button's icon ID. You can also set the icon ID of the
  360. // AGAIconCheckBox directly (cast the mAGAObject to AGAIconCheckBox*). If you want
  361. // the on/off states to have different icons, you can specify different icon IDs.
  362. //
  363.  
  364. class AGAIconCheckBoxPP : public AGACheckBoxPP
  365.     {
  366.     public:
  367.  
  368.         AGAIconCheckBoxPP(LStream* inStream);
  369.         virtual ~AGAIconCheckBoxPP();
  370.         
  371.         enum { class_ID = 'GCic' };
  372.         static AGAIconCheckBoxPP*    CreateStream(LStream* inStream);
  373.  
  374.     protected:
  375.  
  376.         virtual void    CreateAGAObject();
  377.         
  378.         // Extra AGA object initialization values
  379.         SInt16    mOffIconID;
  380.         SInt16    mOnIconID;
  381.     };
  382.  
  383. //
  384. // AGAIconCheckBoxPPX ----------------------------------------------------
  385. //
  386. // Extended AGAIconCheckBoxPP class for use with custom pane template.
  387. // The off and on icon IDs are read from the stream.
  388. //
  389.  
  390. class AGAIconCheckBoxPPX : public AGAIconCheckBoxPP
  391.     {
  392.     public:
  393.  
  394.         AGAIconCheckBoxPPX(LStream* inStream);
  395.         virtual ~AGAIconCheckBoxPPX();
  396.         
  397.         enum { class_ID = 'GXic' };
  398.         static AGAIconCheckBoxPPX*    CreateStream(LStream* inStream);
  399.     };
  400.  
  401. //
  402. // AGAIconRadioButtonPP ----------------------------------------------------
  403. //
  404. // LStdRadioButton replacement subclass that implements an icon button that behaves
  405. // like a radio button -- you click it and it turns on, and the others in its
  406. // tab group are turned off. The mUserCon is used to obtain the
  407. // button's icon ID. You can also set the icon ID of the AGAIconRadioButton
  408. // directly (cast the mAGAObject to AGAIconRadioButton*). If you want the on/off
  409. // states to have different icons, you can specify different icon IDs.
  410. //
  411.  
  412. class AGAIconRadioButtonPP : public AGARadioButtonPP
  413.     {
  414.     public:
  415.  
  416.         AGAIconRadioButtonPP(LStream* inStream);
  417.         virtual ~AGAIconRadioButtonPP();
  418.         
  419.         enum { class_ID = 'GCir' };
  420.         static AGAIconRadioButtonPP*    CreateStream(LStream* inStream);
  421.  
  422.     protected:
  423.  
  424.         virtual void    CreateAGAObject();
  425.         
  426.         // Extra AGA object initialization values
  427.         SInt16    mOffIconID;
  428.         SInt16    mOnIconID;
  429.     };
  430.  
  431. //
  432. // AGAIconRadioButtonPPX ----------------------------------------------------
  433. //
  434. // Extended AGAIconRadioButtonPP class for use with custom pane template.
  435. // The off and on icon IDs are read from the stream.
  436. //
  437.  
  438. class AGAIconRadioButtonPPX : public AGAIconRadioButtonPP
  439.     {
  440.     public:
  441.  
  442.         AGAIconRadioButtonPPX(LStream* inStream);
  443.         virtual ~AGAIconRadioButtonPPX();
  444.         
  445.         enum { class_ID = 'GXir' };
  446.         static AGAIconRadioButtonPPX*    CreateStream(LStream* inStream);
  447.     };
  448.  
  449. //
  450. // AGAGroupBoxPP ----------------------------------------------------
  451. //
  452. // LGroupBox replacement subclass. Defaults to primary group box type.
  453. //
  454.  
  455. class AGAGroupBoxPP : public LGroupBox
  456.     {
  457.     public:
  458.  
  459.         AGAGroupBoxPP(LStream* inStream);
  460.         virtual ~AGAGroupBoxPP();
  461.         
  462.         AGAGroupBox*    mAGAObject;
  463.  
  464.         enum { class_ID = 'GCgb' };
  465.         static AGAGroupBoxPP*    CreateStream(LStream* inStream);
  466.  
  467.     protected:
  468.  
  469.         // PowerPlant overrides
  470.         virtual void    FinishCreateSelf();
  471.         virtual void    DrawSelf();
  472.         virtual void    EnableSelf();
  473.         virtual void    DisableSelf();
  474.  
  475.         virtual void    CreateAGAObject();
  476.         
  477.         // Extra AGA object initialization values
  478.         Boolean    mIsPrimaryGroup;
  479.         OSType    mGapPaneID;
  480.     };
  481.  
  482. //
  483. // AGAGroupBoxPPX ----------------------------------------------------
  484. //
  485. // Extended AGAGroupBoxPP class for use with custom pane template.
  486. // The group box type and the gap pane ID are read from the stream.
  487. //
  488.  
  489. class AGAGroupBoxPPX : public AGAGroupBoxPP
  490.     {
  491.     public:
  492.  
  493.         AGAGroupBoxPPX(LStream* inStream);
  494.         virtual ~AGAGroupBoxPPX();
  495.         
  496.         enum { class_ID = 'GXgb' };
  497.         static AGAGroupBoxPPX*    CreateStream(LStream* inStream);
  498.     };
  499.  
  500. //
  501. // AGASecondaryGroupBoxPP ----------------------------------------------------
  502. //
  503. // LGroupBox replacement subclass with secondary group box type.
  504. //
  505.  
  506. class AGASecondaryGroupBoxPP : public AGAGroupBoxPP
  507.     {
  508.     public:
  509.  
  510.         AGASecondaryGroupBoxPP(LStream* inStream);
  511.         virtual ~AGASecondaryGroupBoxPP();
  512.         
  513.         enum { class_ID = 'GCgs' };
  514.         static AGASecondaryGroupBoxPP*    CreateStream(LStream* inStream);
  515.     };
  516.  
  517. //
  518. // AGAScrollBarPP -------------------------------------------------------
  519. //
  520. // LStdControl/scrollBarProc replacement subclass. To use live scrolling, set the
  521. // AGAScrollBar state directly and either install a notification routine
  522. // or handle the scroll bar's fEventNumber by checking the current value.
  523. // To use proportional indicator, set the AGAScrollBar state directly.
  524. //
  525. // Note that LScroller instantiates its scroll bars for you, so you
  526. // don't need to know about this class when it's being used as part of
  527. // an AGAScrollerPP (LScroller).
  528. //
  529.  
  530. typedef void (*AGANotifyPPPtr)(LPane* theIndicator, SInt32 dataValue, void* userData);
  531.  
  532. class AGAScrollBarPP : public LStdControl
  533.     {
  534.     public:
  535.  
  536.         AGAScrollBarPP(LStream* inStream);
  537.         AGAScrollBarPP(const SPaneInfo    &inPaneInfo,
  538.                         MessageT        inValueMessage,
  539.                         Int32            inValue,
  540.                         Int32            inMinValue,
  541.                         Int32            inMaxValue,
  542.                         Int16            inControlKind,
  543.                         ResIDT            inTextTraitsID,
  544.                         Str255            inTitle,
  545.                         Int32            inMacRefCon);
  546.         virtual ~AGAScrollBarPP();
  547.         
  548.         AGAScrollBar*    mAGAObject;
  549.  
  550.         enum { class_ID = 'GCsb' };
  551.         static AGAScrollBarPP*    CreateStream(LStream* inStream);
  552.         
  553.         // PowerPlant overrides
  554.         virtual void    SetValue(SInt32 inValue);
  555.         virtual void    SetMinValue(SInt32 inMinValue);
  556.         virtual void    SetMaxValue(SInt32 inMaxValue);
  557.         
  558.         virtual void    InstallNotificationRoutine(AGANotifyPPPtr notificationRoutine, void* userData);
  559.         virtual void    HandleNotification(SInt32 dataValue);
  560.         
  561.         AGANotifyPPPtr    mNotificationRoutine;
  562.         void*            mUserData;
  563.         
  564.     protected:
  565.  
  566.         // PowerPlant overrides
  567.         virtual void    FinishCreateSelf();
  568.         virtual void    DrawSelf();
  569.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  570.         virtual void    EnableSelf();
  571.         virtual void    DisableSelf();
  572.         virtual void    ShowSelf();
  573.  
  574.         virtual void    CreateAGAObject();
  575.         
  576.         static void RealAGANotifier(AGATrackingIndicator* theIndicator, SInt32 dataValue, void* userData);
  577.     };
  578.  
  579. //
  580. // AGAScrollerPP ----------------------------------------------------
  581. //
  582. // LScroller replacement subclass that creates AGAScrollBarPP objects
  583. // rather than LStdControl/scrollBarProc objects.
  584. //
  585. // The problem is that there's no single bottleneck for creating
  586. // the scroll bars. MakeScrollBars is declared private, so we cannot
  587. // override that. Basically we have to postprocess each constructor
  588. // and make new scroll bars to replace the old ones.
  589. //
  590.  
  591. class AGAScrollerPP : public LScroller
  592.     {
  593.     public:
  594.  
  595.         AGAScrollerPP(LStream* inStream);
  596.         virtual ~AGAScrollerPP();
  597.         
  598.         enum { class_ID = 'GCsc' };
  599.         static AGAScrollerPP*    CreateStream(LStream* inStream);
  600.  
  601.         virtual void    HandleNotification(LPane* theScrollBar, SInt32 dataValue);
  602.  
  603.     protected:
  604.     
  605.         // PowerPlant overrides
  606.         virtual void    FinishCreateSelf();
  607.         virtual void    AdjustScrollBars();
  608.  
  609.         virtual void    MakeCustomScrollBars(Int16 inHorizBarLeftIndent, Int16 inHorizBarRightIndent, Int16 inVertBarTopIndent, Int16 inVertBarBottomIndent);
  610.  
  611.         LStdControl        *mOldVerticalBar;
  612.         LStdControl        *mOldHorizontalBar;
  613.         
  614.         static void ScrollBarNotifier(LPane* theScrollBar, SInt32 dataValue, void* userData);
  615.     };
  616.  
  617. //
  618. // AGASliderPP -------------------------------------------------------
  619. //
  620. // LControl subclass. To set/get the value, use the LControl value
  621. // methods. The mUserCon is used as the resource ID of an 'STR#' resource
  622. // that contains the slider labels; in this case, the range is
  623. // automatically set to match the number of labels, and the slider
  624. // will have a pointy indicator. If the ID is zero or invalid, the
  625. // slider will be rectangular.
  626. //
  627.  
  628. class AGASliderPP : public LControl
  629.     {
  630.     public:
  631.  
  632.         AGASliderPP(LStream* inStream);
  633.         virtual ~AGASliderPP();
  634.         
  635.         AGASlider*    mAGAObject;
  636.  
  637.         enum { class_ID = 'GCsl' };
  638.         static AGASliderPP*    CreateStream(LStream* inStream);
  639.         
  640.         // PowerPlant overrides
  641.         virtual void    SetValue(SInt32 inValue);
  642.         virtual void    SetMinValue(SInt32 inMinValue);
  643.         virtual void    SetMaxValue(SInt32 inMaxValue);
  644.  
  645.     protected:
  646.  
  647.         // PowerPlant overrides
  648.         virtual void    FinishCreateSelf();
  649.         virtual void    DrawSelf();
  650.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  651.         virtual void    EnableSelf();
  652.         virtual void    DisableSelf();
  653.  
  654.         virtual void    CreateAGAObject();
  655.         
  656.         // Extra AGA object initialization values
  657.         ResIDT    mLabelsResourceID;
  658.         ResIDT    mLabelsTextTraitsID;    // -1 for standard slider labels style
  659.         SInt32    mSliderJustification;    // not used for unlabled sliders
  660.     };
  661.  
  662. //
  663. // AGASliderPPX -------------------------------------------------------
  664. //
  665. // Extended AGASliderPP class for use with custom pane template.
  666. // The labels STR# resource ID, text traits ID, and justification
  667. // are read from the stream.
  668. //
  669.  
  670. class AGASliderPPX : public AGASliderPP
  671.     {
  672.     public:
  673.  
  674.         AGASliderPPX(LStream* inStream);
  675.         virtual ~AGASliderPPX();
  676.         
  677.         enum { class_ID = 'GXsl' };
  678.         static AGASliderPPX*    CreateStream(LStream* inStream);
  679.     };
  680.  
  681. //
  682. // AGALittleArrowsPP -------------------------------------------------------
  683. //
  684. // LControl subclass You will need to either install a notification
  685. // routine to respond to arrow tracking, or subclass and override
  686. // the HandleNotification member function. However:
  687. //
  688. // If you simply want to link the little arrows to a number LEditField
  689. // pane, just put the LEditField's pane ID the little arrows pane's
  690. // mUserCon, and the arrows will automatically increment/decrement
  691. // the LEditField view's value, within the value range of the little
  692. // arrows LControl settings.
  693. //
  694.  
  695. class AGALittleArrowsPP : public LControl
  696.     {
  697.     public:
  698.  
  699.         AGALittleArrowsPP(LStream* inStream);
  700.         virtual ~AGALittleArrowsPP();
  701.         
  702.         virtual void    InstallNotificationRoutine(AGANotifyPPPtr notificationRoutine, void* userData);
  703.         virtual void    HandleNotification(SInt32 deltaValue);
  704.         
  705.         AGANotifyPPPtr    mNotificationRoutine;
  706.         void*            mUserData;
  707.  
  708.         AGALittleArrows*    mAGAObject;
  709.  
  710.         enum { class_ID = 'GCla' };
  711.         static AGALittleArrowsPP*    CreateStream(LStream* inStream);
  712.         
  713.     protected:
  714.  
  715.         // PowerPlant overrides
  716.         virtual void    FinishCreateSelf();
  717.         virtual void    DrawSelf();
  718.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  719.         virtual void    EnableSelf();
  720.         virtual void    DisableSelf();
  721.  
  722.         virtual void    CreateAGAObject();
  723.         
  724.         static void RealAGANotifier(AGALittleArrows* theAGAObject, SInt32 deltaValue, void* userData);
  725.  
  726.         LEditField*    mLinkedNumberText;
  727.         
  728.         // Extra AGA object initialization values
  729.         OSType    mLinkedPaneID;
  730.     };
  731.  
  732. //
  733. // AGALittleArrowsPPX -------------------------------------------------------
  734. //
  735. // Extended AGALittleArrowsPP class for use with custom pane template.
  736. // The linked LEditField pane ID is read from the stream.
  737. //
  738.  
  739. class AGALittleArrowsPPX : public AGALittleArrowsPP
  740.     {
  741.     public:
  742.  
  743.         AGALittleArrowsPPX(LStream* inStream);
  744.         virtual ~AGALittleArrowsPPX();
  745.         
  746.         enum { class_ID = 'GXla' };
  747.         static AGALittleArrowsPPX*    CreateStream(LStream* inStream);
  748.     };
  749.  
  750. //
  751. // AGAPopupMenuPP -------------------------------------------------------
  752. //
  753. // LStdPopupMenu replacement subclass that implements an AGA popup menu.
  754. //
  755.  
  756. class AGAPopupMenuPP : public LStdPopupMenu
  757.     {
  758.     public:
  759.  
  760.         AGAPopupMenuPP(LStream* inStream);
  761.         virtual ~AGAPopupMenuPP();
  762.         
  763.         AGAPopupMenu*    mAGAObject;
  764.  
  765.         enum { class_ID = 'GCpo' };
  766.         static AGAPopupMenuPP*    CreateStream(LStream* inStream);
  767.  
  768.         // PowerPlant overrides
  769.         virtual void    SetValue(SInt32 inValue);
  770.         
  771.     protected:
  772.  
  773.         // PowerPlant overrides
  774.         virtual void    FinishCreateSelf();
  775.         virtual void    DrawSelf();
  776.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  777.         virtual void    EnableSelf();
  778.         virtual void    DisableSelf();
  779.         virtual void    ShowSelf();
  780.  
  781.         virtual void    CreateAGAObject();
  782.         
  783.         SInt16    mStashedTitleWidth;
  784.     };
  785.  
  786. //
  787. // AGADisclosureTrianglePP -------------------------------------------------------
  788. //
  789. // LControl subclass Set/get the AGADisclosureTriangle state
  790. // directly. Think of it as a check box -- it's either on or off.
  791. // The initial on/off value is taken from the LControl value.
  792. //
  793.  
  794. class AGADisclosureTrianglePP : public LControl
  795.     {
  796.     public:
  797.  
  798.         AGADisclosureTrianglePP(LStream* inStream);
  799.         virtual ~AGADisclosureTrianglePP();
  800.         
  801.         AGADisclosureTriangle*    mAGAObject;
  802.  
  803.         enum { class_ID = 'GCdt' };
  804.         static AGADisclosureTrianglePP*    CreateStream(LStream* inStream);
  805.         
  806.     protected:
  807.  
  808.         // PowerPlant overrides
  809.         virtual void    FinishCreateSelf();
  810.         virtual void    DrawSelf();
  811.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  812.         virtual void    EnableSelf();
  813.         virtual void    DisableSelf();
  814.  
  815.         virtual void    CreateAGAObject();
  816.     };
  817.  
  818. //
  819. // AGAProgressIndicatorPP -------------------------------------------------------
  820. //
  821. // LControl subclass. Use the standard LControl value methods to set the
  822. // progress indicator range and value. Access the AGAProgressIndicator
  823. // directly to set the origin value if desired. For indeterminate progress,
  824. // set min=max and then call Animate repeatedly. 
  825. //
  826.  
  827. class AGAProgressIndicatorPP : public LControl
  828.     {
  829.     public:
  830.  
  831.         AGAProgressIndicatorPP(LStream* inStream);
  832.         virtual ~AGAProgressIndicatorPP();
  833.         
  834.         AGAProgressIndicator*    mAGAObject;
  835.  
  836.         enum { class_ID = 'GCpr' };
  837.         static AGAProgressIndicatorPP*    CreateStream(LStream* inStream);
  838.         
  839.         // PowerPlant overrides
  840.         virtual void    SetValue(SInt32 inValue);
  841.         virtual void    SetMinValue(SInt32 inMinValue);
  842.         virtual void    SetMaxValue(SInt32 inMaxValue);
  843.  
  844.     protected:
  845.  
  846.         // PowerPlant overrides
  847.         virtual void    FinishCreateSelf();
  848.         virtual void    DrawSelf();
  849.  
  850.         virtual void    CreateAGAObject();
  851.     };
  852.  
  853. //
  854. // AGAWhiteBackgroundAttachmentPP ----------------------------------------------------
  855. //
  856. // An attachment that you should attach to any subview where the window has
  857. // a gray background but the particular subview needs a white background.
  858. // Editable text fields and list boxes are the most common examples.
  859. // AGAEditFieldPP and AGAListBoxPP both add one of these automatically.
  860. //
  861.  
  862. class AGAWhiteBackgroundAttachmentPP : public LAttachment
  863.     {
  864.     public:
  865.  
  866.         AGAWhiteBackgroundAttachmentPP(MessageT inMessage = msg_DrawOrPrint, Boolean inExecuteHost = true);
  867.         AGAWhiteBackgroundAttachmentPP(LStream *inStream);
  868.  
  869.         enum { class_ID = 'GCwa' };
  870.         static AGAWhiteBackgroundAttachmentPP*    CreateStream(LStream* inStream);
  871.         
  872.         virtual    Boolean    Execute(MessageT inMessage, void *ioParam);
  873.     };
  874.  
  875. //
  876. // AGABorderFrameAttachmentPP ----------------------------------------------------
  877. //
  878. // An attachment that you should attach to any subview where the subview
  879. // needs a "3D" sunken frame around it. Editable text fields and list
  880. // boxes are the most common examples.
  881. // AGAEditFieldPP and AGAListBoxPP both add one of these automatically.
  882. //
  883.  
  884. class AGABorderFrameAttachmentPP : public LAttachment
  885.     {
  886.     public:
  887.  
  888.         AGABorderFrameAttachmentPP(MessageT inMessage = msg_DrawOrPrint, Boolean inExecuteHost = true);
  889.         AGABorderFrameAttachmentPP(LStream *inStream);
  890.  
  891.         enum { class_ID = 'GCba' };
  892.         static AGABorderFrameAttachmentPP*    CreateStream(LStream* inStream);
  893.         
  894.         virtual    Boolean    Execute(MessageT inMessage, void *ioParam);
  895.     };
  896.  
  897. //
  898. // AGAEditFieldPP -------------------------------------------------------
  899. //
  900. // LEditField subclass that attaches an AGAWhiteBackgroundAttachmentPP
  901. // and an AGABorderFrameAttachmentPP to itself.
  902. // It also knows how to draw the disabled text frame in gray color
  903. // rather than dithered black pattern.
  904. //
  905.  
  906. class AGAEditFieldPP : public LEditField
  907.     {
  908.     public:
  909.  
  910.         AGAEditFieldPP(LStream* inStream);
  911.         virtual ~AGAEditFieldPP();
  912.         
  913.         enum { class_ID = 'GCed' };
  914.         static AGAEditFieldPP*    CreateStream(LStream* inStream);
  915.  
  916.     protected:
  917.  
  918.         virtual void    DrawBox();
  919.  
  920.     };
  921.  
  922. //
  923. // AGATextEditPP -------------------------------------------------------
  924. //
  925. // LTextEdit subclass that attaches an AGAWhiteBackgroundAttachmentPP
  926. // and an AGABorderFrameAttachmentPP to itself.
  927. //
  928.  
  929. class AGATextEditPP : public LTextEdit
  930.     {
  931.     public:
  932.  
  933.         AGATextEditPP(LStream* inStream);
  934.         virtual ~AGATextEditPP();
  935.         
  936.         enum { class_ID = 'GCte' };
  937.         static AGATextEditPP*    CreateStream(LStream* inStream);
  938.     };
  939.  
  940. //
  941. // AGASeparatorPP -------------------------------------------------------
  942. //
  943. // LPane subclass that implements an AGA separator.
  944. //
  945.  
  946. class AGASeparatorPP : public LPane
  947.     {
  948.     public:
  949.  
  950.         AGASeparatorPP(LStream* inStream);
  951.         virtual ~AGASeparatorPP();
  952.         
  953.         AGASeparator*    mAGAObject;
  954.  
  955.         enum { class_ID = 'GCse' };
  956.         static AGASeparatorPP*    CreateStream(LStream* inStream);
  957.         
  958.     protected:
  959.  
  960.         // PowerPlant overrides
  961.         virtual void    FinishCreateSelf();
  962.         virtual void    DrawSelf();
  963.  
  964.         virtual void    CreateAGAObject();
  965.     };
  966.  
  967. //
  968. // AGACaptionPP -------------------------------------------------------
  969. //
  970. // LCaption replacement subclass. Dims with gray text instead of
  971. // patBic gray pattern erasing; suppresses erasing background to white
  972. // when text is changed.
  973. //
  974.  
  975. class AGACaptionPP : public LCaption
  976.     {
  977.     public:
  978.  
  979.         AGACaptionPP(LStream* inStream);
  980.         virtual ~AGACaptionPP();
  981.         
  982.         AGAStaticText*    mAGAObject;
  983.  
  984.         enum { class_ID = 'GCca' };
  985.         static AGACaptionPP*    CreateStream(LStream* inStream);
  986.  
  987.         // PowerPlant overrides
  988.         virtual void    SetDescriptor(ConstStringPtr inDescriptor);
  989.         virtual void    SetValue(SInt32 inValue);
  990.         
  991.     protected:
  992.  
  993.         // PowerPlant overrides
  994.         virtual void    FinishCreateSelf();
  995.         virtual void    DrawSelf();
  996.  
  997.         virtual void    CreateAGAObject();
  998.     };
  999.  
  1000. //
  1001. // AGAListBoxPP -------------------------------------------------------
  1002. //
  1003. // LListBox replacement subclass that replaces the default LFocusBox
  1004. // with an AGAFocusBoxPP AGA-style focus frame, and attaches an
  1005. // AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP to
  1006. // itself.
  1007. //
  1008.  
  1009. class AGAListBoxPP : public LListBox
  1010.     {
  1011.     public:
  1012.  
  1013.         AGAListBoxPP(LStream* inStream);
  1014.         virtual ~AGAListBoxPP();
  1015.         
  1016.         enum { class_ID = 'GClb' };
  1017.         static AGAListBoxPP*    CreateStream(LStream* inStream);
  1018.         
  1019.     protected:
  1020.  
  1021.         // PowerPlant overrides
  1022.         virtual void    FinishCreateSelf();
  1023.     };
  1024.  
  1025. //
  1026. // AGAFocusBoxPP -------------------------------------------------------
  1027. //
  1028. // LFocusBox replacement subclass that implements an AGA focus frame.
  1029. // The AGAListBoxPP class replaces the standard LFocusBox with one of
  1030. // these.
  1031. //
  1032.  
  1033. class AGAFocusBoxPP : public LFocusBox
  1034.     {
  1035.     public:
  1036.  
  1037.         AGAFocusBoxPP();
  1038.         AGAFocusBoxPP(const LFocusBox &inOriginal);
  1039.         AGAFocusBoxPP(LStream* inStream);
  1040.         virtual ~AGAFocusBoxPP();
  1041.         
  1042.         enum { class_ID = 'GCfb' };
  1043.         static AGAFocusBoxPP*    CreateStream(LStream* inStream);
  1044.         
  1045.     protected:
  1046.     
  1047.         virtual void    ComputeBorderRegion(RgnHandle borderRegion);
  1048.  
  1049.         // PowerPlant overrides
  1050.         virtual void    DrawSelf();
  1051.     };
  1052.  
  1053. #endif // __GRAYCOUNCILPP__
  1054.  
  1055.